<?php 
$obj = new Articles();
$params = array(
    'offset' => isset($_GET['page'])?(int)$_GET['page']:0
    );
$articles = $obj->select($params);
$total = $obj->count();
?>
<div id="content">
    <?php foreach ($articles as $article): ?>
        <div class="post">
            <h1 class="title"><a href="#"><?php echo $article['title']; ?></a></h1>
            <p class="meta"><small><?php echo date('d-m-Y', $article['created']); ?></small></p>
            <div class="entry">
                    <?php echo $article['body']; ?>
            </div>

        </div>
    <?php endforeach; ?>


    <!-- DC Pagination:A1 Start -->
    <ul class="tsc_pagination tsc_paginationA tsc_paginationA01">
        <?php 
            $pagination = new Pagination();
            $params = array_merge($params, array(
                'current_page' => isset($_GET['page'])?$_GET['page']:0,
                'total_page' => $total,
                'file' => 'index.php'
            ));
            echo $pagination->display($params);
        ?>
    </ul>
    <!-- DC Pagination:A1 End -->
</div>